package com.victor.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.victor.dao.TicketOrdersDao;
import com.victor.entity.TicketOrders;
import com.victor.service.TicketOrderService;

@Service
public class TicketOrderServiceImpl implements TicketOrderService{
	@Autowired
	private TicketOrdersDao ticketorderDao;

	@Override
	public PageInfo<TicketOrders> selAll(int page, int row,Map<Object, Object> map) {
		PageHelper.startPage(page, row);
		List<TicketOrders> list = ticketorderDao.selAll(map);
		return new PageInfo<>(list, 5);
	}

	@Override
	public PageInfo<TicketOrders> selOrderByNumber(String number,int page,int row) {
		PageHelper.startPage(page, row);
		List<TicketOrders> list = ticketorderDao.selByNumber(number);
		return new PageInfo<>(list, 5);
	}

	@Override
	public TicketOrders selByOrderId(Integer id) {
		return ticketorderDao.selById(id);
	}

	@Override
	public boolean deleteOrder(int[] ids) {
		return ticketorderDao.deleteByPrimaryKey(ids);
	}

	@Override
	public boolean updateOrder(TicketOrders ticketOrders) {
		return ticketorderDao.updateByPrimaryKeySelective(ticketOrders);
	}

	@Override
	public PageInfo<TicketOrders> selByTime(String start, String end, int page, int row) {
		PageHelper.startPage(page, row);
		List<TicketOrders> list = ticketorderDao.selByTime(start,end);
		return new PageInfo<>(list, 5);
	}

}
